<!--列表页-->
<style type="text/css">
 .ui.print.ui.button:hover{background: #078ef2;}
 .ui.dropdown.selection{width: 160px}
</style>
<div class="cont"> 
<div class="position" id="page_title"><img alt="位置图标" src="dist/images/position.png" />合同管理&gt;客户合同<a ng-click="openDetail('',index_key)" ng-hide="$needClientCache" title="打开新窗口查看"><i class="large External icon"></i></a></div>
  <div class="mybackground">
    <div class="cont_fr_top">   
      <div class="menus_top">
        <div class="menus_l">处理状态:</div>
        <ul id="nav">
          <li class="selected state5"><a ng-click="ContractList(5)"> 全部</a> </li>
          <li class="state6">  <a  ng-click="ContractList(6)"> 待审核   </a> </li>
          <li class="state4">  <a  ng-click="ContractList(4)"> 签订中   </a> </li>
          <li class="state1">  <a  ng-click="ContractList(1)"> 服务中   </a> </li>
          <li class="state3">  <a  ng-click="ContractList(3)"> 已到期   </a> </li>
          <li class="state2">  <a  ng-click="ContractList(2)"> 升级作废 </a> </li>
          <li class="state-1"> <a ng-click="ContractList(-1)">取消合同  </a> </li>
        </ul>
        <button class="clear_btn fr" ng-click="sweep()" style="margin-top: 5px" ng-if="searchKey==4"> 扫码邮寄 </button>
        <div class="cont_fr_btn">
          <div style="height: 20px;">
            <div class="fr">
              <button class="cont_f_btn3" ng-click="batch_show(search.state)" ng-hide="cont_but">编辑邮寄</button>
            </div>
          </div>
        </div>                    
      </div>
     <div class="menus" >
      <div class="menus_con ui form">
        <div class="four fields" ng-keyup="$event.keyCode == 13 && search_list()">
          <div class="inline field">
            <label>综合查询</label>
             <input type="text" ng-Model="search.customer" placeholder="客户名/电话/编号" maxlength="15" style="width: 160px">
          </div>
          <div class="inline field">
            <label>业务人员</label>
            <input type="text" ng-Model="search.sales" placeholder="业务人员" style="width: 160px">
          </div>
          <div class="inline field">
            <label>首次服务时间</label>
            <div class="ui left icon input">
              <input ng-model="search.first_time" placeholder="开始时间" datetimepicker format="YYYY-MM-DD" id="firstTime" style="width:160px;height: 32px">
              <i class="calendar icon"></i>
            </div>
          </div>
          <div class="inline field">
            <div class="ui left icon input">
              <input ng-model="search.second_time" placeholder="结束时间" datetimepicker format="YYYY-MM-DD"
                id="secondTime" style="width:160px;height: 32px">
              <i class="calendar icon"></i>
            </div>
          </div>
        </div>
        <div class=" fields">
          <div class="inline field ">
            <label>订购产品</label>
              <select name='product' ng-model="search.product" class="ui dropdown" >
                <option value="">订购产品</option>
                <option ng-repeat="x in productList" value="{{x.product_id}}">{{x.name}}</option>
              </select> 
          </div>
        </div>
        <div class=" fields">
          <div class="inline field">
            <button class="clear_btn" ng-click="search_list()" style="margin-left: 4.5em"> 查找</button>
          </div>
          <div class="inline field">
            <button class="clear_btn"  ng-click="export_contract()" style="padding: 0 18px;">导出合同</button>
          </div>
          <div class="inline field">
            <button class="clear_btn"  ng-click="export_violations()" style="padding: 0 18px;">导出违规</button>
          </div>
          <div class="inline field" ng-if="searchKey==6">
              <button class="clear_btn"  ng-click="batchEcontract()" style="padding: 0 18px;">生成电子合同</button>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<div class="menus">
  <div class="menus_table">
    <table class="ui celled yellow striped table">
      <thead>
        <tr>
          <th>客户名       </th>
          <!-- <th>订单编号     </th> -->
          <th  style="width:100px;">签订金额     </th>
          <th style="width:105px;">开始时间     </th>
          <th>订购产品     </th>
          <th style="width:100px;">业务员       </th>
          <th style="width:100px;">团队名称     </th>
          <th>客户归属地   </th>
          <th>合同状态     </th>
          <th>是否违规     </th>
          <th style="width:105px;">是否发生退款 </th>
          <th>是否合并     </th>
          <th style="text-align:center;width:115px;" >操作</th>
        </tr>
      </thead>
      <tbody>
        <tr ng-repeat="vlist in contractList">
          <td>
              <div float_layer customer-id='vlist.customer_id' show-name="vlist.nickname"></div>
          </td>
         <!--  <td> {{vlist.payrecord_order}}</td> -->
          <td style="text-align:right;"> {{vlist.mount}} </td> 
          <td> {{vlist.start_time}}    </td>
          <td> {{vlist.name}}          </td> 
          <td> {{vlist.user_name}}     </td>      
          <td> {{vlist.company_name}}  </td>
          <td> {{vlist.location}}      </td>
          <td>          
            <div ng-switch="vlist.state">
              <div ng-switch-when="-1">已取消</div>
              <div ng-switch-when="0">待审核 </div>
              <div ng-switch-when="2">升级作废</div>
              <div ng-switch-when="3">已到期</div>
              <div ng-switch-when="4">签订中</div>
              <div ng-switch-default>服务中</div>
            </div>
          </td>
          <td>
            <div ng-switch="vlist.weigui_status">
              <div ng-switch-when="0">否</div>
              <div ng-switch-when="11" style="color:red">是 </div>
              <div ng-switch-when="12" style="color:red">是</div>
              <div ng-switch-default>否</div>
            </div>
          </td>
          <td>
            <div ng-switch="vlist.is_refund">
              <div ng-switch-when="1" style="color:red">是</div>
              <div ng-switch-default>否</div>
            </div>
          </td>
          <td> 
            <div ng-switch="vlist.is_need_combine">
              <div ng-switch-when="1">
                 <p> <a ng-click="merge_show(vlist.contract_id)">需要合并</a> </p>
              </div>
              <div ng-switch-default>
                 <p> 不需要 </p>
              </div>
            </div>
          </td>
          <td style="overflow: visible;text-align:center; padding:0.2em">
            <div class="ui dropdown  item " id="menu{{$index}}"  ng-click="operation($index)"  > 
              <div class="ui button" ng-click="operation($index)" style="padding: 7px 20px; ">合同管理</div> 
              <div class="menu">
              <!--   <div class="item" ng-click="look_over(vlist.contract_id)">        合同详情 </div> -->
                <div class="item" ng-click="showContractDetail(vlist.contract_id)">合同详情</div>
                <div class="item" ng-click="print_show(vlist.contract_id)"    ng-if="vlist.state == '1' || vlist.state == '0' || vlist.state == '4' ">   打印合同 </div>
                <div class="item" ng-click="mail_contract()" ng-if="vlist.state == '1' || vlist.state == '0' || vlist.state == '4' ">   合同邮寄 </div>
                <div class="item" ng-click="econtract(vlist.contract_id)"  ng-if="vlist.state==0||vlist.state ==4">电子签订</div>
                <div class="item" ng-click="editor_show(vlist.contract_id)"   ng-if="vlist.state == '1' || vlist.state == '0' || vlist.state == '4' " >  编辑合同 </div>
                <div class="item" ng-click="cancel_remind(vlist.contract_id)" ng-if="vlist.state == '1' || vlist.state == '0' || vlist.state == '4' "  > 取消合同 </div>
              </div>
            </div>
          </td>
        </tr>
        <tr ng-show="(contractList && contractList.length == 0) ||(!contractList)">
          <td colspan="11" style="color:red;">
            <p style="text-align:center;">还没有找到数据~~~</p>
          </td>
        </tr>
      </tbody>
    </table>
     <div ng-show="ContractPage.pageAll > 1" class="ui borderless fr pagination menu" jspagination   page-object="ContractPage" page-func="ContractList" >
  </div>
</div>

<!--合同扫码-->
<div class="ui small sweep modal">
  <i class="close icon"></i>
  <div class="header_h4"> 合同扫码 </div>
  <div class="content" style="padding: 30px">
    <div class="ui form">
      <div name="frm-sweep" id="frm-sweep">
        <div class="field" style="text-align: center"> 请输入合同编号 </div>
        <div class="field" style="height:80px">
          <input type="text" name="sweep" id="checkSweep" ng-model="sweepContract" ng-keyup="$event.keyCode == 13 && sweepSubmit()" placeholder="合同编号" >
          <input type="hidden" id="isExist" name="isExist" >
        </div>
      </div>
    </div>
  </div>
   <div class="actions" style="text-align: center;">
    <button class="ui positive button "> 确 认 </button> 
    <div class="ui grey button negative "> 取 消 </div>
  </di>
</div>

<!--邮寄合同加载-->
<div class="ui view modal">
  <i class="close icon"></i>
  <div class="header_h4" style="margin-bottom:10px"> 合同邮寄 </div>
  <a class="ui button" ng-click="mail_contract()" style="margin-left:7%;margin-bottom:10px">纸质邮寄</a>
  <a class="ui button" style="margin-left:7%;margin-bottom:10px">电子签订</a>
   <ng-include src="'views/comm/contract.html'" class="ui row"></ng-include>
</div>

<!--合同编辑-->
<div class="ui editor modal">
  <i class="close icon"></i>
  <div class="header_h4"> 合同编辑 </div>
  <div class="content">
   <div class=" form">
    <form class="ui form"  name="frm-editor"   id="frm-editor">
      <input type="hidden" name="contract_id"  id="cId" ng-model="contractId">
      <input type="hidden" name="check_customer"  >
      <input type="hidden" name="check_customer_phone"  >
        <div class="three fields">
          <div class="inline field required">
            <label>订购产品</label>
              <div class="ui selection dropdown" id="product_">
                  <input type="hidden" name="product" ng-model="editor.product_id">
                  <i class="dropdown icon"></i>
                  <div class="default text">订购产品</div>
                  <div class="menu">
                      <div class="item" data-value="{{x.product_id}}" ng-if="$index!=0" ng-repeat="x in productList" >{{x.name}}</div>
                  </div>
              </div>          
          </div>
          <div class="field required">
            <label class="label_fl">产品金额</label>
             <input  name="mount" ng-model="editor.mount" ng-blur="check_time()"  placeholder="产品金额(元)" style="width:160px;height: 32px">
          </div>
          <div class="inline field required">
            <label>合同状态</label>
               <div class="ui selection dropdown" id="statu_">
                  <input type="hidden" name="state" ng-model="editor.state">
                  <i class="dropdown icon"></i>
                  <div class="default text">合同状态</div>
                  <div class="menu">
                      <div class="item" data-value="{{x.k}}"  ng-repeat="x in contract_status" >{{x.v}}</div>
                  </div>
              </div> 
          </div>
        </div>
        <div class="three fields ">
          <div class="inline field required">
            <label>签订状态</label>
              <div class="ui selection dropdown" id="sign_">
                  <input type="hidden" name="sign_status" ng-model="editor.sign_status">
                  <i class="dropdown icon"></i>
                  <div class="default text">签订状态</div>
                  <div class="menu">
                      <div class="item" data-value="{{x.k}}"  ng-repeat="x in sign_status" >{{x.v}}</div>
                  </div>
              </div> 
          </div>
          <div class="field required" id="stime_check">
            <label class="label_fl" >开始时间</label>
            <div class="ui left icon input required" style="width: 160px;height:32px">
              <input name="start_time" ng-change="check_time()" ng-blur="check_time()" ng-model="editor.start_time" format="YYYY-MM-DD" id="start_time" placeholder="开始时间" datetimepicker style="width:160px;height: 32px">
              <i class="calendar icon"></i>
            </div>
            <div class="ui red pointing prompt label " ng-hide="text_error" ng-class='{error:isError}'>{{messageText}}</div> 
          </div>
          <div class="field required" id="etime_check">
            <label  class="label_fl">结束时间</label>
            <div class="ui left icon input required" style="margin-left: 0.2em;width: 160px;height:32px">
              <input name="end_time" id="end_time" ng-change="check_time()" ng-blur="check_time()" ng-model="editor.end_time" datetimepicker format="YYYY-MM-DD" placeholder="结束时间"  style="width:160px;height: 32px">
              <i class="calendar icon"></i>
            </div>
              <div class="ui red pointing prompt label " ng-hide="text_wrong" ng-class='{wrong:isWrong}'>{{messageTexts}}</div>
          </div>
        </div>
        <div class="three fields">
          <div class="inline field">
            <label >合同标题</label>
            <input  name="title" ng-model="editor.title" style="width:160px;height: 32px;margin-left:0.7em" placeholder="合同标题">
          </div>
          <div class="field check_field">
            <label class="label_fl">乙方姓名</label>
            <input  name="second_party_name" ng-model="editor.second_party_name" ng-blur="checkCustomer(editor.customer_id)" style="width:160px;height: 32px;margin-left:0.5em; float:left" placeholder="乙方姓名">
          </div>
          <div class="inline field">
            <label>乙方邮箱</label>
            <input  name="second_party_email" ng-model="editor.second_party_email" style="width:160px;height: 32px;margin-left:0.7em" placeholder="乙方邮箱">
          </div>
        </div>
        <div class="three fields ">
          <div class=" field check_field">
            <label class="label_fl">乙方电话</label>
            <input  name="second_party_phone" ng-model="editor.second_party_phone" ng-blur="checkCustomer(editor.customer_id)" style="width:160px;height: 32px;margin-left:0.7em; float:left" placeholder="乙方电话">
          </div>
          <div class="inline field">
            <label>乙方地址</label>
            <input  name="second_party_address" ng-model="editor.second_party_address" style="width:160px;height: 32px;margin-left:0.5em" placeholder="乙方地址">
          </div>
          <div class="inline field">
            <label>乙方身份证</label>
            <input  name="second_party_idcard" ng-model="editor.second_party_idcard" style="width:160px;height: 32px;margin-left: -0.2em" placeholder="乙方身份证">
          </div>
        </div>
        <div class="three fields">
          <div class="inline field">
            <label>甲方账号名</label>
            <input  name="first_party_name" ng-model="editor.first_party_name" style="width:160px;height: 32px;margin-left: -0.2em" placeholder="甲方账号名">
          </div> 
          <div class="inline field">
            <label >甲方地址</label>
            <input  name="first_party_address" ng-model="editor.first_party_address" style="width:160px;height: 32px;margin-left: 0.5em" placeholder="甲方地址">
          </div>
          <div class="inline field">
            <label>开户账号</label>
            <input  name="first_party_bank_account" ng-model="editor.first_party_bank_account" style="width:160px;height: 32px;margin-left:0.7em" placeholder="甲方开户账号">
          </div>
        </div>
        <div class="three fields">
          <div class="inline field">
            <label>甲方开户银行</label>
            <input  name="first_party_bank_deposit" ng-model="editor.first_party_bank_deposit" style="width:160px;height: 32px;margin-left:-1em" placeholder="甲方开户银行">
          </div>
          <div class="inline field">
            <label>风险问卷回执</label>
            <input  name="survey_code" ng-model="editor.survey_code" style="width:160px;height: 32px;margin-left:-1em" placeholder="风险问卷回执">
          </div>
        </div>
        <div class="three fields">
          <div class="inline field" style="width:80%;">
            <label>备注信息</label>
            <input name="remark" ng-model="editor.remark"  placeholder="备注信息" style="width:80%;margin-left:0.7em">
          </div>
        </div>
      </form>
    </div>
  </div> 
  <div class="actions" style="text-align: center;">
    <div class="ui positive button">确定</div>
    <div class="ui grey  negative button">{{'BTN_CANCEL' | translate}}</div>
  </div>
</div>
<!--合并-->
<div class="ui merge large modal" >
  <i class="close icon"></i>
  <div class="header_h4"> 合同合并 </div>
  <div class="content">
    <div class="ui form">
      <form class="ui form"  name="frm-merge" id="frm-merge">
        <div class="ui segment">
          <div class="two fields" >
            <div class="field">
              <b>合同记录 </b>
            </div>
             <div class="field">
              <input type="text" ng-model="may"  placeholder="客户编号" style="width:160px;height: 32px"> 
              <div class="ui button" ng-click="may_exist()">添 加</div>
            </div>
          </div>
          <table class="ui celled table">
            <thead>
              <tr>
                <th> 合并到       </th>
                <th> 被合并合同   </th>
                <th> 客户姓名     </th>
                <th> 订购产品     </th>
                <th> 金额         </th>
                <th> 开始时间     </th>
                <th> 结束时间     </th>
                <th> 业务员       </th>
                <th> 经理         </th>
                <th> 合同状态     </th>
              </tr>
            </thead>
            <tbody>
              <tr ng-repeat="m in merge_record" >
                <td> <input type="radio" name="radio" ng-click="radio_show($event,m.contract_id,m.mount,m.order_num)" ng-checked="m.contract_id == merge.contract_id" value="m.contract_id" /> </td>
                <td> <input type="checkbox" value="{{m.contract_id}}" id="checkbox{{m.contract_id}}" name="checkbox"  ng-click="radio_show($event,m.mount,m.contract_id)" ng-checked="mergeId == m.contract_id" ng-disabled="m.contract_id == merge.contract_id"/> </td>
                <td> {{ m.customer_name }}      </td>
                <td> {{ m.name }}               </td>
                <td> {{ m.mount }}              </td>
                <td> {{ m.start_time }}         </td>
                <td> {{ m.end_time }}           </td>
                <td> {{ m.user_name }}          </td>
                <td> {{ m.manager }}            </td>
                <td>
                  <div ng-switch="m.state">
                   <div ng-switch-when="-1"> 已取消  </div>
                   <div ng-switch-when="0"> 待审核   </div>
                   <div ng-switch-when="2"> 升级作废 </div>
                   <div ng-switch-when="3"> 已到期   </div>
                   <div ng-switch-when="4"> 签订中   </div>
                   <div ng-switch-default>  服务中   </div>
                  </div>
                </td>        
              </tr>
            </tbody>
          </table>
          <div><b>升级可更改信息</b></div>
          <div class=" fields" >
            <div class="five wide field">
              <label class="label_fl">订购产品</label>
              <div class="ui left icon input" style="width: 160px;">
                <select class="ui dropdown" ng-model="merge.product_id" name="product" id="productId">
                    <option value="">订购产品</option>
                    <option value="{{x.product_id}}" ng-repeat="x in productList" ng-if="$index!=0" ng-selected="merge.product_id == x.product_id">{{x.name}}</option>
                </select>
              </div>
            </div>
            <div class="three wide field"></div>
            <div class=" five wide field">
              <label class="label_fl">合同金额</label>
               <input name="pay_mount" ng-Model="mount"  placeholder="合同金额(元)" style="width:160px;height:32px" >    
            </div>
          </div>
          <div class="two fields" >
            <div class="inline field" >
              <label>开始时间</label>
              <div class="ui left icon input">
                <input ng-model="merge.start_time" datetimepicker format="YYYY-MM-DD" name="start_time" id="stime" placeholder="合同开始时间"  style="width:160px;height: 32px">
                <i class="calendar icon"></i>
              </div>
            </div>
            <div class="inline field">
               <label>结束时间</label>
               <div class="ui left icon input">
                <input ng-model="merge.end_time" datetimepicker format="YYYY-MM-DD" name="end_time" id="etime" placeholder="合同结束时间"  style="width:160px;height: 32px">
                <i class="calendar icon"></i>
               </div>
            </div>  
          </div> 
        </div>
      </form>
    </div>
  </div>
  <div class="actions" style="text-align: center;">
    <div class="ui positive button" >确定</div>
    <div class="ui grey  button negative">{{'BTN_CANCEL' | translate}}</div>
  </di>  
</div>
<!--打印合同-->
<div class="ui print modal">
    <i class="close icon"></i>
    <div class="header_h4"> 打印合同 </div>
    <div class="content">
       <div class="ui button" ng-click="print_contract('LoadingContent')" id="print-button" style="margin-left:4.5em">打印合同</div>
      <form action="#" name="frm-mylog" id="frm-mylog">
        <iframe name="print_frame" width="0" height="0" frameborder="0" src="about:blank"></iframe> 
        <ng-include src="'views/comm/contract.html'" class="ui row"></ng-include>
      </form>
    </div>
</div>
<!--合同详情-->
<ng-include src="'views/header.html'" ng-if="contractDetails == 1" class="ui row" style="display:none"></ng-include>
<!--合同邮寄-->
<div class="ui mail large modal">
  <i class="close icon"></i>
  <div class="header_h4"> {{mailTitle}} </div>
  <div class="content">
    <div class="ui form">
      <form name="frm-mail" id="frm-mail" >
        <input type="hidden" name="sales_id"      id="sales_person" >
        <input type="hidden" name="contract"      id="contract">
        <input type="hidden" name="customer_id"   id="customerId">
        <input type="hidden" name="sales_manager" id="manager">
        <input type="hidden" name="sales_sector"  id="sectorId">
        <input type="hidden" name="delivery"      id="delivery">
        <input type="hidden" name="sales_subcompany" id="companyId">
        <input type="hidden" name="status" id="mailStatus">
        <input type="hidden" name="delivery_id" id="mailId">
        <input type="hidden" name="confirm_param" id="confirmParam">
        <div class="ui segment" >
          <div><b>客户信息</b></div>
          <div class="ui segment">
              <div class="four fields" >
                <div class="field">
                  <span>客户姓名 :  </span>
                  {{ mail.nickname }}
                </div>
                <div class="field">
                  <span>客户电话 : </span>
                   {{mail_tel}}
                </div>
                <div class="field">
                  <span>业务人员 : </span>
                  {{mail.user_name}}
                </div>
                <div class="field">
                  <span>团队: </span>
                  {{mail.company_name}}
                </div>
              </div>
              <div class="four fields" >
                <div class="field" >
                  <span>订购产品 : </span>
                  {{mail.name}}
                </div>
                <div class="field">
                   <span>金额(元) : </span>
                   {{mail.mount}}
                </div>
                <div class="field">
                   <span>开始时间: </span>
                   {{mail.start_time}}
                </div>
                <div class="field">
                   <span>结束时间 : </span>
                   {{mail.end_time}}
                </div>
              </div>
              <div class="four fields">
                <div class="inline field">
                   <span class="fl" style="margin-right: 3px;">合同状态 : </span>
                    <div ng-switch="mail.state" style="float:left">
                      <div ng-switch-when="-1"> 已取消  </div>
                      <div ng-switch-when="0"> 待审核   </div>
                      <div ng-switch-when="2"> 作废升级 </div>
                      <div ng-switch-when="3"> 已到期   </div>
                      <div ng-switch-when="4"> 签订中   </div>
                      <div ng-switch-default>  服务中   </div>
                    </div>
                </div>
              </div>
            </div>
          <div ng-hide='mail_empty' ><b>邮寄记录</b></div>
          <table class="ui celled table" ng-hide='mail_empty'>
            <thead>
              <tr>
                <th>快递运单号</th>
                <th>快递公司</th>
                <th>邮寄时间</th>
                <th>收件人姓名</th>
                <th>收件人电话</th>
                <th>收件人地址</th>
                <th>备注信息</th>
                <th>合同签订状态</th>
                <th>邮寄状态 </th>
              </tr>
            </thead>
            <tbody>
              <tr ng-repeat="v in mail.child" >
                <td> {{ v.delivery_num }} </td>
                <td> {{ v.send_way }}     </td>
                <td> {{ v.send_time }}    </td>
                <td> {{ v.recipients }}   </td>
                <td> {{ v.phone }}        </td>
                <td> {{ v.address }}      </td>
                <td> {{ v.remark }}       </td>
                <td>
                  <div ng-switch="v.source_status"> 
                    <div ng-switch-when="10"> 签订完成 </div>
                    <div ng-switch-default>  未处理    </div>
                  </div>
                </td>
                <td>
                  <div ng-switch="v.status"> 
                    <div ng-switch-when="20"> 确认邮寄 </div>
                    <div ng-switch-when="30"> 邮寄中   </div>
                    <div ng-switch-when="40"> 邮寄完成 </div>
                    <div ng-switch-when="50"> 已取消 </div>
                    <div ng-switch-default>  待邮寄    </div>
                  </div>
                </td>
              </tr>
            </tbody>
          </table>
        </div> 
        <div ng-hide="mailMessage"><b>邮寄信息</b></div>
        <div ng-hide="mailMessage">
            <div class="three fields" style="margin-top:13px" >
              <div class="field required">
                  <label class="label_fl">收件人姓名</label>
                  <input type="text" name="recipients" ng-model='record.recipients' placeholder="收件人姓名" style="width: 160px;height: 32px">
              </div>
              <div class=" field required">
                  <label class="label_fl">收件人地址</label>
                  <input type="text" name="address" ng-model='record.address' placeholder="邮寄地址" style="width: 160px;height: 32px;margin-left:0.4em">
              </div>
              <div class=" field  required">
                  <label class="label_fl">收件人电话</label>
                  <input type="text" name="phone" ng-model='record.phone' maxlength="15" placeholder="收件人电话" style="width: 160px;height: 32px">
              </div>
            </div>
            <div class="three fields">
              <div class=" field required" id="sendTime">
                  <label class="label_fl">创建时间</label>
                  <div class="ui left icon input required" style="width: 160px;height:32px;margin-left:0.9em">
                      <input type="text" name="send_time" datetimepicker id="send_time" ng-model="default_date" format='YYYY-MM-DD' ng-change="checkTime()" placeholder="邮寄时间">
                      <i class="calendar icon"></i>
                  </div>
                  <div class="ui red pointing prompt label " ng-hide="check_times" ng-class='{isError:isSend_time}'>{{messagesTextse}}</div>
              </div>
              <div class=" field required" style="margin-left:-0.6em">
                  <label class="label_fl">合同签订状态</label>
                  <div class="ui selection dropdown" id="signDefault" >
                      <input type="hidden" name="sign_status">
                      <i class="dropdown icon"></i>
                      <div class="default text">合同签订状态</div>
                      <div class="menu">
                          <div class="item" data-value="0" >未处理</div>
                          <div class="item" data-value="10" >签订完成</div>
                      </div>
                  </div>
              </div>
            </div>
            <div class="inline field">
                <label>备注信息</label>
                <input type="text" name="remark" ng-model="record.remark" placeholder="备注信息" style="width: 80%;height: 32px;margin-left:1.4em">
            </div>
        </div>
        <div ng-hide="remarkMessage" style="text-align: center;color:red">当前合同无法添加邮寄记录, 您需先完成当前邮寄记录,再重新补发.</div>
      </form>
    </div>   
  </div>
  <div class="actions" style="text-align: center;" >
    <div class="ui positive button" ng-hide="mailMessage">确定</div>
    <div class="ui positive button" ng-click="go('/delivery')" ng-hide="remarkMessage" style="width:130px">前往邮寄管理</div>
    <div class="ui grey negative button " ng-hide="sweepMail" ng-click="sweep()">取消</div>
    <div class="ui grey negative button " ng-hide="ordinaryMail" ng-click="close()" >取消</div>
  </div>
</div>
<!--合同批量邮寄编辑-->
<div class="ui batch large modal">
  <i class="close icon"></i>
  <div class="header_h4"> 编辑合同邮寄 </div>
  <div class="content">
   <div class=" form" style="overflow: auto; height: 600px;">
    <form class="ui form" name="frm-batch" id="frm-batch" >
      <input type="hidden" name="status" id="statusId{{$index}}">
      <table class="ui padded table">
        <thead>
          <tr style="white-space:nowrap">
            <th style="width:60px"> 复选框  </th>
            <th style="width:160px">客户姓名   </th>
            <th style="width:80px"> 业务员     </th>
            <th style="width:80px"> 业务经理   </th>
            <th style="width:160px">创建时间   </th>
            <th style="width:80px"> 收件人姓名 </th>
            <th style="width:160px">收件人地址 </th>
            <th style="width:80px"> 收件人电话 </th>
            <th style="width:240px"> 备注      </th>
          </tr>
        </thead>
        <tbody>
          <tr ng-repeat="x in batchList">
            <td style="width:80px"> <input type="checkbox" class="check_list"  name="checkbox_mail" ng-click="check_checkbox(x.contract_id)" value="{{x.contract_id}}" />   </td>
            <td style="width:160px"><span style="width:160px">{{ x.customer_nickname }}</span>  </td>
            <td style="width:80px"> {{ x.user_name }}         </td>
            <td style="width:80px"> {{ x.manager }}           </td>
            <td style="width:160px">  
              <div class="ui left icon input">
                <input ng-model="x.send_time" datetimepicker format="YYYY-MM-DD" id="send_time{{x.contract_id}}"  placeholder="邮寄时间" disabled style="width:130px">
                <i class="calendar icon"></i>
              </div>
              
            </td>
            <td style="width:160px">  <input type="text" ng-Model="x.recipients" id="recipients{{x.contract_id}}" disabled ng-style="style" style="width:100px"> </td>
            <td style="width:80px"> <input type="text" ng-Model="x.address" disabled id="address{{x.contract_id}}" ng-style="style" style="width:160px" > </td>
            <td style="width:80px">  <input type="text" ng-Model="x.phone" disabled id="phone{{x.contract_id}}" ng-style="style" maxlength="15" style="width:140px"> </td>
            <td style="width:240px"> <input type="text" ng-Model="x.remark"  disabled id="remark{{x.contract_id}}" ng-style="style" style="width:240px">   </td>
          </tr>  
          <tr ng-hide="batch_empty">
            <td colspan="11" style="text-align:center;margin-top:10px;color:red" >没有找到数据~~~</td>
          </tr>
        </tbody>
      </table>
    </form>
  </div>
  <div class="actions" style="text-align: center;">
    <div class="ui positive button" ng-click="batch_editor()" style="padding-top:10px">确定</div>
    <div class="ui grey  negative button" style="padding-top:10px">{{'BTN_CANCEL' | translate}}</div>
  </di>
</div>

<!--批量操作结果-->
<div class="ui small error_shw modal modal1" style="text-align: center;">
    <div class="header_h4">系统提示</div>
    <div class="content">
        <table class="ui table" border="1">
          <thead>
            <tr><th style="text-align:center">标题</th><th style="text-align:center">提示信息</th></tr>
          </thead>
          <tbody>
            <tr> 
              <td style="text-align:center"> 更新失败数据 <span style="color:red"> {{ failure }} </span> </td> 
          </tbody>
        </table>
    </div>
    <div class="actions" style="padding:14px;">
      <div class="center" style="margin-bottom:10px;">
          <div class="ui pop_btn_qx negative ">关闭</div>
      </div>
    </div>
</div>
<!--即将到期合同-->
<div class="ui will_be modal">
  <i class="close icon"></i>
  <div class="header_h4"> 即将到期的合同 </div>
  <div class="content">
    <table class="ui column table">
        <thead>
          <tr>
            <th> 客户姓名 </th>
            <th> 客户电话 </th>
            <th> 合同单号 </th>
            <th> 订购时间 </th>
            <th> 订购产品 </th>
            <th> 服务人员 </th>
            <th> 团队名称 </th>
            <th> 到期时间 </th>
          </tr>
        </thead>
        <tbody>
          <tr ng-repeat="vlist in check.remind">
            <td> {{vlist.customer_name}} </td>
            <td> {{vlist.phone}}         </td> 
            <td> {{vlist.order_num}}     </td> 
            <td> {{vlist.start_time}}    </td>
            <td> {{vlist.name}}          </td> 
            <td> {{vlist.user_name}}     </td>      
            <td> {{vlist.company_name}}  </td>
            <td> {{vlist.end_time}}      </td>
          </tr>
        </tbody>
      </table>
  </div>
</div>

<!-- 电子合同签订 -->
<div class="ui econtract modal">
    <i class="close icon"></i>
    <div class="header_h4">生成电子合同</div>
    <div class="content">
        <div class="ui form">
        <form action="#" method="post" class="econtract form">
            <h2 class="ui small header">合同信息</h2>
            <div class="four fields">
                <div class="field">
                    <span>客户姓名:</span>
                    {{econtractData.nickname}}
                </div>
                <div class="field">
                    <span>客户电话:</span>
                    {{econtractData.phone}}
                </div>
                <div class="field">
                    <span>业务人员:</span>
                    {{econtractData.sales}}
                </div>
                <div class="field">
                    <span>所属团队:</span>
                    {{econtractData.team}}
                </div>
            </div>
            <div class="four fields">
                <div class="field">
                    <span>订购产品:</span>
                    {{econtractData.product}}
                </div>
                <div class="field">
                    <span>金额:</span>
                    {{econtractData.mount}}
                </div>
                <div class="field">
                    <span>开始时间:</span>
                    {{econtractData.start_time|limitTo:10}}
                </div>
                <div class="field">
                    <span>结束时间:</span>
                    {{econtractData.end_time|limitTo:10}}
                </div>
            </div>

            <h2 class="ui small header">签订状态</h2>
            <div class="two fields">
                <div class="field">
                    <span ng-if="econtractData.sign_status ==0 ">未签订</span>
                    <span ng-if="econtractData.sign_status !=0">已签订</span>
                    <a class="ui button " target="_blank" ng-if="econtractData.sign_status==10 && econtractData.view_url" ng-href="{{econtractData.view_url}}">查看签订合同</a>
                </div>
            </div>
            <div class="ui icon message" ng-if="econtractData.state==4" style="margin:0;padding:0.2em 0;">
                <i class="red warning circle icon"></i>
                <div class="content">
                  <p>该合同已经在签订中,再次推送会覆盖以前推送的合同信息,请谨慎推送电子合同!</p>
                </div>
              </div>
        </form>
        </div>
    </div>
    <div class="actions">
        <button class="ui green button positive ng-binding">确定</button>
        <button class="ui grey button negative ng-binding">取消</button>
    </div>
</div>
<!-- //电子合同签订 -->


<!-- 电子合同批量签订 -->
<div class="ui batch_econtract large modal">
    <i class="close icon"></i>
    <div class="header_h4">生成电子合同</div>
    <div class="content loading">
        <div style="overflow: auto; max-height: 600px;" class="ui form">
            <table class="ui fixed single striped table">
                <thead>
                    <tr class="ui center aligned">
                        <th>
                            <input type="checkbox" ng-model="batch_econtracht_all">全选
                        </th>
                        <th>客户姓名</th>
                        <th>客户电话</th>
                        <th>业务人员</th>
                        <th>订购产品</th>
                        <th>金额</th>
                        <th>开始时间</th>
                        <th>结束时间</th>
                        <th>签订状态</th>
                        <th>提交状态</th>
                    </tr>
                </thead>
            <tbody>
                <tr ng-repeat="(k,vitem) in batchContractData" class="ui center aligned">
                    <td>
                        <input type="checkbox" ng-model="batchSignCheck[k]" ng-checked="batchSignCheck[k]" value="{{vitem.contract_id}}" >
                    </td>
                    <td>{{vitem.nickname}}</td>
                    <td>{{vitem.phone}}</td>
                    <td>{{vitem.sales}}</td>
                    <td>{{vitem.product}}</td>
                    <td>{{vitem.mount}}</td>
                    <td>{{vitem.start_time|limitTo:10}}</td>
                    <td>{{vitem.end_time|limitTo:10}}</td>
                    <td>
                      <span ng-if="vitem.sign_status ==0">未签订</span>
                      <span ng-if="vitem.sign_status !=0">已签订</span>
                    </td>
                    <td ng-if="!vitem.msg">未提交</td>
                    <td ng-if="vitem.msg">{{vitem.msg}}</td>
                </tr>
            </tbody>
            </table>
        </div>
    </div>
    <div class="actions">
        <button class="ui green button positive ng-binding">确定</button>
        <button class="ui grey button negative ng-binding">取消</button>
    </div>
</div>
<!-- //电子合同批量签订 -->

<!--邮寄添加成功弹窗-->
<div class="ui mail_record modal transition">
    <div class="header_h4">系统提示</div>
    <div class="content">
        <p style="text-align: center;">{{fineMsg}}</p>
    </div>
    <div class="actions">
      <div class="ui positive button" ng-click="ContractList(searchKey)" style="width:130px">继续管理合同</div>
      <a class="ui grey button negative" href="#delivery/{{herfParam}}" style="width:130px">前往邮寄管理</a>
    </div>  
</div>
<!--取消提醒-->
<div class="ui large delete modal modal3" style="text-align: center;">
    <div class="header">取消合同</div>
    <div class="content">
        <i class="huge blue help circle icon"></i>
        <p style="padding-top: 15px;">确认取消该合同的信息吗?</p>
    </div>
    <div class="actions" style="text-align: center;">
      <div class="ui positive button" ng-click="cancel(remind_id)">确认</div>
      <div class="ui grey negative button ">取消</div>
    </div>
</div>
<!--成功弹窗-->
<div class="ui small modal modal5 time" style="text-align: center;">
    <div class="header">提示</div>
    <div class="content">
        <i class="huge green check circle outline icon"></i>
        <p style="padding-top: 15px;">{{Msg}}</p>
    </div>
</div>
<!--失败-->
<div class="ui modal modal2 time" style="text-align: center;">
    <div class="header">提示</div>
    <div class="content"> 
        <i class="huge red warning  outline icon "></i>
        <p style="padding-top: 15px;">{{Msg}} </p>
    </div>
</div>
<script type="text/javascript">
  $('.ui.dropdown').dropdown();
  $("#nav li").click(function(){ 
    $(this).addClass("selected").siblings().removeClass("selected"); 
  });
  $("#view-but li").click(function(){
    $(this).addClass("selected").siblings().removeClass("selected");
  });
/***********************开始时间与结束时间验证***********************************/
  $.fn.form.settings.rules.checktime_merge = function() {
      var isValid = true;
      var start_time = $('#frm-merge input[name="start_time"]').val();
      var end_time = $('#frm-merge input[name="end_time"]').val();
      if(start_time && end_time && start_time > end_time)
          isValid = false;
      else if(start_time < end_time)
          isValid = true;
  return isValid;
  };
/***********************开始时间与结束时间验证***********************************/
  $.fn.form.settings.rules.checktime_editor = function() {
    var isValid = true;
    var start_time = $('#frm-editor input[name="start_time"]').val();
    var end_time = $('#frm-editor input[name="end_time"]').val();
    if(start_time && end_time && start_time > end_time)
        isValid = false;
    else if(start_time < end_time)
        isValid = true;
  return isValid;
  };
  /***********************扫描页面验证***********************************/
  $.fn.form.settings.rules.checkSweep = function() {
            var isValid = true;
            var isExist = $('#frm-sweep input[name="isExist"]').val();
            if(isExist == 1){
              $("#checkSweep").select();  
              isValid = false;
                      
            }else 
                isValid = true;
        return isValid;
    };

/********************客户是否存在************************************/
  $.fn.form.settings.rules.checkMember = function() {
            var isValid = false;
            var isExist = $('#frm-editor input[name="check_customer"]').val();
            var phoneExist = $('#frm-editor input[name="check_customer_phone"]').val();
            if(isExist == 1 || phoneExist == 1){
              isValid = false; 
            }else 
                isValid = true;  
        return isValid;
    };
  
/*********************表单验证**********************************/
  $("#frm-sweep").form({
     on: 'blur',
     inline : true,
      fields: {
        sweep: {
          rules: [
            {
              type   : 'empty',
               prompt : '合同编号不能空!!!'
            },{
                type   : 'checkSweep',
                prompt : '查询合同失败,请重新输入!!!'
            }
          ]
        },
      }
  })
  $('#frm-editor').form({
    on: 'blur',
    inline : true,
    fields: {
      mount: {
        rules: [
          {
            type   : 'empty',
             prompt : '产品金额不能空!!!'
          },{
            type   : 'number',
            prompt : '产品金额必须是数字!!!'
          }, {
            type   : 'integer[1..]',
            prompt : '产品金额不能小于1的数字!!!'
          }
        ]
      },
      second_party_name: {
        rules: [
          {
            type   : 'checkMember',
             prompt : '客户信息已存在!!!'
          }
        ]
      },
      second_party_phone: {
        rules: [
          {
            type   : 'checkMember',
             prompt : '客户信息已存在!!!'
          }
        ]
      },
    }
  });
  $('#frm-mail').form({
    on: 'blur',
    inline : true,
    fields: {
      recipients: {
        rules: [
          {
            type   : 'empty',
             prompt : '收件人姓名不能空!!!'
          }
        ]
      },
      address: {
        rules: [
          {
            type   : 'empty',
             prompt : '邮寄地址不能空!!!'
          }
        ]
      },
      phone: {
        rules: [
          {
            type   : 'empty',
             prompt : '收件人电话不能空!!!'
          },
          {
             type   : 'number',
             prompt : '电话号码只允许数字!!!'
          },
          {
            type   : 'minLength[7]',
            prompt : '电话号码不能少于7位数字!!!'
          }
        ]
      },
       main_content: {
        rules: [
          {
            type   : 'empty',
             prompt : '邮寄内容不能空!!!'
          }
        ]
      }, 
      sign_status:{
        rules: [
          {
            type   : 'empty',
             prompt :'合同签订状态不能空!!!'
          }
        ]
      }
    }
  });
  $('#frm-merge').form({
    on: 'blur',
    inline : true,
    fields: {
      start_time: {
        identifier:'start_time',
        rules: [
           {
                type   : 'checktime_merge',
                prompt : '合同结束时间不能小于开始时间!!!'
            }   
        ]},
      end_time: {
        rules: [
            {
                type   : 'checktime_merge',
                prompt : '合同结束时间不能小于开始时间!!!'
            }
               
        ]},
      pay_mount: {
        rules: [
          {
            type   : 'integer[1..]',
             prompt : '报价金额必须是整数!!!'
          },
          {
            type   : 'empty',
             prompt : '报价金额不能空!!!'
          }
        ]
      },
     product: {
     
        rules: [
          {
            type   : 'empty',
             prompt : '订购产品不能空!!!'
          }
        ]
      },
    }
  });
</script>

